Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.Common

Public MustInherit Class DataAccess

    Private _ConnectString As String = ""
    Public Property ConnectString() As String
        Get
            Return _ConnectString
        End Get
        Set(ByVal value As String)
            _ConnectString = value
        End Set
    End Property

    Private _EnableCaching As Boolean
    Public Property EnableCaching() As Boolean
        Get
            Return _EnableCaching
        End Get
        Set(ByVal value As Boolean)
            _EnableCaching = value
        End Set
    End Property

    Private _CacheDurration As Integer
    Public Property CacheDurration() As Integer
        Get
            Return _CacheDurration
        End Get
        Set(ByVal value As Integer)
            _CacheDurration = value
        End Set
    End Property


    Public ReadOnly Property Cache() As Cache
        Get
            Return HttpContext.Current.Cache
        End Get
    End Property

    Protected Function ExecuteNonQuery(ByVal cmd As System.Data.Common.DbCommand) As Integer
        Return cmd.ExecuteNonQuery()
    End Function
    Public Function ExecuteReader(ByVal cmd As DbCommand, ByVal Behavior As CommandBehavior)
        Return cmd.ExecuteReader(Behavior)
    End Function
    Public Function ExecuteReader(ByVal cmd As System.Data.Common.DbCommand) As System.Data.IDataReader
        Return ExecuteReader(cmd, CommandBehavior.Default)
    End Function
    Public Function executeScalar(ByVal cmd As DbCommand)
        Return cmd.ExecuteScalar
    End Function
End Class


